namespace wyd
{
	// 适配器 -- 复用
	template<class Iterator, class Ref, class Ptr>
	class reverse_iterator
	{
        typedef reverse_iterator<Iterator, Ref, Ptr> Self;

    public:
        reverse_iterator(Iterator it) 
            : _it(it) 
        {}

        Ref operator*() 
        {
            Iterator tmp = _it;
            return *(--tmp);
        }

        Ptr operator->()
        {
            return &(operator*());
        }

        Self& operator++()
        {
            --_it;
            return *this;
        }

        Self operator++(int)
        {
            Iterator tmp = _it;
            --it;
            return tmp;
        }

        Self& operator--()
        {
            ++_it;
            return *this;
        }

        Self operator--(int)
        {
            Iterator tmp = _it;
            ++it;
            return tmp;
        }

        bool operator!=(const Self& rit) const 
        {
            return _it != rit._it;
        }


    private:
		Iterator _it;
	};
}